/**
 * @param {number[]} prices
 * @return {number}
 */
var maxProfit = function (prices) {
  let profile = 0
  for(let i=1;i<prices.length;i++){
    if(prices[i]>prices[i-1]){
      profile+=prices[i]-prices[i-1]
    }
  }
  return profile
}
maxProfit([7,1,5,3,6,4])